package com.lee.api.client;

import com.lee.common.model.AppResult;
import com.lee.common.model.Message;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@FeignClient(value = "message-service", path = "/message")
public interface MessageClient {
    @PostMapping("/send")
    public AppResult send(@RequestParam("receiveUserId") Long receiveUserId,
                          @RequestParam("content") String content);

    @GetMapping("getUnReadCount")
    public AppResult<Integer> getUnReadCount();

    @GetMapping("/getAll")
    public AppResult<List<Message>> getAll();

    @PostMapping("/markRead")
    public AppResult markRead(HttpServletRequest request,
                              @RequestParam("id") Long id);

    @PostMapping("/reply")
    public AppResult reply(HttpServletRequest request,
                           @RequestParam("repliedId") Long repliedId,
                           @RequestParam("content") String content);

    @GetMapping("/gethistory")
    public AppResult<List<Message>> reply(@RequestParam("receiveUserId") Long receiveUserId);
}
